#include <iostream>
#include <vector>
using namespace std;


int maxProfit(vector<int> &prices) {
    // Start typing your C/C++ solution below
    // DO NOT write int main() function
    if(prices.size() < 2){
        return 0;
    }
    int totProfit = 0;
    int lastPrice = prices[0];
    for(int i=1; i<prices.size(); ++i){
        int curPrice = prices[i];
        int delta = curPrice - lastPrice;
        if(delta > 0){
            totProfit += delta;
        }
        lastPrice = curPrice;
    }

    return totProfit;

}

int main(){
    return 0;
}